﻿using System.Collections.Generic;

namespace Daq.Tools.HttpClientHelper
{
    /// <summary>
    /// HTTP请求参数基础
    /// </summary>
    public class BaseDaqRequest
    {
        /// <summary>
        /// 请求头
        /// </summary>
        public Dictionary<string, string> HeadersKv { get; private set; } = new Dictionary<string, string>();

        /// <summary>
        /// 请求耗时时间秒
        /// </summary>
        public int TimeoutSecond { get; private set; } = 100;

        /// <summary>
        /// 添加请求超时前等待时间
        /// </summary>
        /// <param name="Timeout">秒，默认100秒</param>
        /// <returns></returns>
        public virtual BaseDaqRequest AddTimeout(int Timeout)
        {
            TimeoutSecond = Timeout;
            return this;
        }

        /// <summary>
        /// 添加请求头
        /// </summary>
        /// <param name="name"></param>
        /// <param name="value"></param>
        /// <returns></returns>
        public virtual BaseDaqRequest AddHeader(string name, string value)
        {
            HeadersKv.Add(name, value);
            return this;
        }
    }
}